import 'package:flutter/material.dart';

class CustomButton extends StatefulWidget {

  CustomButton({
    Key key,
    this.color,
    this.content,
    this.padding,
    this.onTap,
  }) : super(key: key);

  EdgeInsets padding;
  Color color;
  String content;
  Function onTap;

  @override
  _CustomButtonState createState() => _CustomButtonState();
}

class _CustomButtonState extends State<CustomButton> {

  @override
  void initState() {
     // TODO: implement initState
     super.initState();
  }

  @override
  Widget build(BuildContext context) {

    return ClipRRect(
      borderRadius: BorderRadius.all(Radius.circular(40)),
      child: Material(
        color: widget.color,
        child: InkWell(
          splashColor: Colors.black54.withOpacity(0.2),
          onTap: () {
            if(widget.onTap != null) {
              widget.onTap();
            }
          },
          child: Container(
            // decoration: BoxDecoration(
            //     borderRadius: BorderRadius.all(Radius.circular(40))
            // ),
            padding: widget.padding != null ? widget.padding
                : EdgeInsets.only(left: 15, top: 10, bottom: 10, right: 15),
            child: Center(
              child: Text('${widget.content}', style: TextStyle(
                  fontSize: 14, color: Colors.white)
              ),
            ),
          ),
        ),
      ),
    );

  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }

}
